package com.edisoncgh.junitTest;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class TriangleTest {
    @ParameterizedTest
    @CsvSource({
            "0, 50, 50, 无效输入",
            "101, 50, 50, 无效输入",
            "0, 0, 0, 无效输入",
            "101, 101, 101, 无效输入"
    })
    public void parametersErrorSituation(int a, int b, int c, String excepted) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(excepted, type);
    }

    @ParameterizedTest
    @CsvSource({
            "3, 4, 6, 一般三角形"
    })
    public void normalSituation(int a, int b, int c, String excepted) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(excepted, type);
    }

    @ParameterizedTest
    @CsvSource({
            "100, 50, 50, 非三角形"
    })
    public void notATriangle(int a, int b, int c, String excepted) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(excepted, type);
    }

    @ParameterizedTest
    @CsvSource({
            "1, 1, 1, 等边三角形",
            "50, 50, 50, 等边三角形",
            "100, 100, 100, 等边三角形"
    })
    public void equilateralSituation(int a, int b, int c, String excepted) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(excepted, type);
    }

    @ParameterizedTest
    @CsvSource({
            "1, 50, 50, 等腰三角形",
            "10, 50, 50, 等腰三角形",
            "90, 50, 50, 等腰三角形"
    })
    public void IsoscelesSituation(int a, int b, int c, String excepted) {
        Triangle triangle = new Triangle();
        String type = triangle.classify(a, b, c);
        assertEquals(excepted, type);
    }
}